/*
 * @Author: 康为 18037890117@163.com
 * @Date: 2023-07-07 17:28:50
 * @LastEditors: 康为 18037890117@163.com
 * @LastEditTime: 2023-07-10 11:22:16
 * @FilePath: /umi-max/src/framework/CardGrid/WithProvider.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React from 'react';
import { ResponsiveProps } from 'react-grid-layout';
import SizeMe from 'react-sizeme';

const WidthProvider = (
  ComposedComponent: React.FC<ResponsiveProps>,
): React.FC<ResponsiveProps> => {
  return function WrappedComponent(props: ResponsiveProps) {
    return <ComposedComponent {...props} />;
  };
};

export default (ComposedComponent: React.FC<ResponsiveProps>) =>
  SizeMe({ monitorWidth: true })(WidthProvider(ComposedComponent));
